/**
 * com.mantisframework.model
 *

 */

package com.mantisframework.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 
 * 
 * 
 * @author 李奎和
 * 
 *         <p>
 *         时间：2013-1-13 下午04:29:00
 *         </p>
 * 
 *         <p>
 *         电子邮件：likh@hwttnet.com
 *         </p>
 */
@Entity
@Table(name = "M_SYS_DEPARTMENT", catalog = "mantisframeworks")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class MSysDepartment implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "DEPT_ID", length = 20)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long deptId;
	@Column(name = "companyId")
	private Long companyId;
	@Column(name = "PARENT_DEPT_ID", columnDefinition = "DEFAULT '0'")
	private Long parentDeptId;
	@Column(name = "DEPT_NAME", length = 200)
	private String deptName;
	@Column(name = "DEPT_CODE", length = 100)
	private String deptCode;
	@Column(name = "DEPT_TYPE", length = 100)
	private String deptType; /* regular-department,branch-company,subsidiaries */
	@Column(name = "CHARGE_ID")
	private Long chargeId;
	@Column(name = "IS_DEL", columnDefinition = "DEFAULT '0'")
	private Integer isDel;
	@Column(name = "DEPT_ORD", columnDefinition = "DEFAULT '0'")
	private Integer deptOrd;
	@Column(name = "DEPT_BRIEF", columnDefinition = "BLOB")
	private byte[] deptBrief;
	@Column(name = "COMMENTS")
	private String comments;

	@ManyToMany
	@JoinTable(name = "M_SYS_USERS_DEPTS", joinColumns = { @JoinColumn(name= "deptId") }, inverseJoinColumns = { @JoinColumn(name="userId") })
	private Set<MSysUsers> users = new HashSet<MSysUsers>();

	/**
	 * @return deptId
	 */

	public Long getDeptId() {
		return deptId;
	}

	/**
	 * @param deptId
	 *            要设置的 deptId
	 */

	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}

	/**
	 * @return companyId
	 */

	public Long getCompanyId() {
		return companyId;
	}

	/**
	 * @param companyId
	 *            要设置的 companyId
	 */

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	/**
	 * @return parentDeptId
	 */

	public Long getParentDeptId() {
		return parentDeptId;
	}

	/**
	 * @param parentDeptId
	 *            要设置的 parentDeptId
	 */

	public void setParentDeptId(Long parentDeptId) {
		this.parentDeptId = parentDeptId;
	}

	/**
	 * @return deptName
	 */

	public String getDeptName() {
		return deptName;
	}

	/**
	 * @param deptName
	 *            要设置的 deptName
	 */

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	/**
	 * @return deptCode
	 */

	public String getDeptCode() {
		return deptCode;
	}

	/**
	 * @param deptCode
	 *            要设置的 deptCode
	 */

	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}

	/**
	 * @return deptType
	 */

	public String getDeptType() {
		return deptType;
	}

	/**
	 * @param deptType
	 *            要设置的 deptType
	 */

	public void setDeptType(String deptType) {
		this.deptType = deptType;
	}

	/**
	 * @return chargeId
	 */

	public Long getChargeId() {
		return chargeId;
	}

	/**
	 * @param chargeId
	 *            要设置的 chargeId
	 */

	public void setChargeId(Long chargeId) {
		this.chargeId = chargeId;
	}

	/**
	 * @return isDel
	 */

	public Integer getIsDel() {
		return isDel;
	}

	/**
	 * @param isDel
	 *            要设置的 isDel
	 */

	public void setIsDel(Integer isDel) {
		this.isDel = isDel;
	}

	/**
	 * @return deptOrd
	 */

	public Integer getDeptOrd() {
		return deptOrd;
	}

	/**
	 * @param deptOrd
	 *            要设置的 deptOrd
	 */

	public void setDeptOrd(Integer deptOrd) {
		this.deptOrd = deptOrd;
	}

	/**
	 * @return comments
	 */

	public String getComments() {
		return comments;
	}

	/**
	 * @param comments
	 *            要设置的 comments
	 */

	public void setComments(String comments) {
		this.comments = comments;
	}

	/**
	 * @return deptBrief
	 */

	public byte[] getDeptBrief() {
		return deptBrief;
	}

	/**
	 * @param deptBrief
	 *            要设置的 deptBrief
	 */

	public void setDeptBrief(byte[] deptBrief) {
		this.deptBrief = deptBrief;
	}

	/**
	 * @return users
	 */

	public Set<MSysUsers> getUsers() {
		return users;
	}

	/**
	 * @param users
	 *            要设置的 users
	 */

	public void setUsers(Set<MSysUsers> users) {
		this.users = users;
	}
}
